from langchain_core.runnables import RunnablePassthrough, RunnableParallel

parallel_chain = RunnableParallel(
    {
        "passed_data": RunnablePassthrough(),
        "modified_data": lambda x: x["question"].upper(),
    }
)

print(parallel_chain.invoke({"question": "hello world"}))

parallel_chain = RunnablePassthrough.assign(
    upper_question=lambda x: x["question"].upper(),
    length=lambda x: len(x["question"]),
)

print(parallel_chain.invoke({"question": "hello world!"}))
